<?php
    // simple ACL hook
    define('M2_MICRO', 1);

    // set errors (On - for development, Off - for production)
    ini_set('display_errors', 'On');

    // start output buffering
    ob_start();

    // setup library
    require_once 'library/error.php';
    require_once 'library/system.php';
    require_once 'library/database.php';

    // setup includes
    require_once 'includes/model.php';
    require_once 'includes/view.php';
    require_once 'includes/controller.php';

    // get global controller class and dispatch data
    global $controller;
    $controller->dispatch();
    
    // show content from buffer
    ob_flush(); ob_clean();

    // close DB connection and clean error & message stack
    global $database, $error;
    $database->close();
    $error->cleanAll();

    // die );
    die();
?>